from typing import List

class Solution:
    def findRotation(self, mat: List[List[int]], target: List[List[int]]) -> bool:
        n = len(mat)
        res0, res90, res180, res270 = True, True, True, True
        for i in range(n):
            for j in range(n):
                res0 = res0 and (mat[i][j] == target[i][j])
                res90 = res90 and (mat[i][j] == target[j][n - i - 1])
                res180 = res180 and (mat[i][j] == target[n - i - 1][n - j - 1])
                res270 = res270 and (mat[i][j] == target[n - j - 1][i])
        return res0 or res90 or res180 or res270